<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html>
 <head>
  <title>微信支付收银台</title>
  <meta name="keywords" content="关键字">
  <meta name="description" content="描述">
  <meta name="content-type" content="text/html;charset=UTF-8">

<script src="<%=basePath%>js/jquery.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	
 </head>

 <body>
 </body>

 <script>
    function onBridgeReady(){
	   	WeixinJSBridge.invoke('getBrandWCPayRequest',{${finaPackage}},
	    	function(res){
	   	       if(res.err_msg=='get_brand_wcpay_request:ok'){
	   	       		//alert("支付成功");
				   window.location.href = '<%=basePath%>success.jsp?activityId=${activityId}';
	   	       }else{
	   	       		alert("支付失败，请稍后再试！");
				   window.location.href = '<%=basePath%>${url}';
	   	       }
     	});
	}
	if (typeof WeixinJSBridge == "undefined"){
	   if( document.addEventListener ){
	       document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
	   }else if (document.attachEvent){
	       document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
	       document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
	   }
	}else{
	   onBridgeReady();
	}
 </script>
</html>
